<template>
	<view class="page">
		<TInput label="日期" type="date" v-model="lostInfo.time" />
		<TInput label="地点" type="text" v-model="lostInfo.place" />
		<TInput label="备注" type="text" v-model="lostInfo.what" />
		<view class="btn" @click="send()">提交</view>
	</view>
</template>

<script>
	import TInput from '../../../components/inputItem/input.vue'
	import {
		offterClue
	} from '../../../network/home.js'
	import {listenerTeam} from '../../../network/login.js'
	export default {
		components: {
			TInput
		},
		data() {
			return {
				lostInfo: {},
				lost_name: ''
			};
		},
		onLoad(options) {
			this.lost_name = options.lost_name
			console.log(options)
		},
		onShow() {
			let location_status = this.$store.state.userInfo.location_status;
			if (location_status != 1) {
				clearInterval(this.$store.state.timer)
				listenerTeam()
			}
		},
		methods: {
			async send() {
				const result = await offterClue({
					lost_name: this.lost_name,
					...this.lostInfo
				})
				if (!result.flag) return;
				uni.showToast({
					title: '上传成功',
					icon: 'none'
				})
				setTimeout(uni.navigateBack, 1000)
				console.log(result)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		background-color: #FFFFFF;

		.title {
			margin: 10px 10px 0;
			text-align: center;
			color: #999999;
		}

		.column {
			margin: 10px 10px;

			textarea {
				display: block;
				width: calc(100% - 10px);
				height: 70px;
				padding: 5px;
				margin-top: 10px;
				background: none;
				outline: none;
				border: 0.5px solid #dddddd;
				border-radius: 3px;
			}

			.choose {
				margin-top: 10px;
				display: flex;
				align-items: center;

				view {
					width: 80px;
					height: 80px;
					border: 1px solid #dddddd;
					border-radius: 3px;
					font-size: 50px;
					line-height: 80px;
					color: #999999;
					text-align: center;
				}

				image {
					margin-right: 20px;
					width: 80px;
					height: 80px;
				}
			}
		}

		.btn {
			width: 50%;
			margin: 30px auto;
			padding: 10px 0;
			background-color: #1CBAB6;
			color: white;
			text-align: center;
			border-radius: 30px;
			cursor: pointer;

			&:active {
				background-color: #999999;
				color: #333333;
			}
		}
	}
</style>
